package cn.com.infcn.spider.domain;

import cn.com.infcn.spider.scheduler.Scheduler;
import cn.com.infcn.spider.scheduler.http.HttpScheduler;

public class HttpJob extends Job {

	private String jobType = "http";

	private String regexFilter; // url爬取规则

	private int depth; // 采集深度

	private int errCount;

	private boolean parseUrl = true; // 是否进行url抽取

	private int threadNum = 1;

	private String rule = "width"; // 采集方式

	private boolean saveHtml;

	private int timeout = 3000;

	public int getTimeout() {
		return timeout;
	}

	public void setTimeout(int timeout) {
		if (timeout <= 0) {
			timeout = 3000;
		}
		this.timeout = timeout;
	}

	public String getRegexFilter() {
		return regexFilter;
	}

	public void setRegexFilter(String regexFilter) {
		this.regexFilter = regexFilter;
	}

	public int getDepth() {
		return depth;
	}

	public void setDepth(int depth) {
		this.depth = depth;
	}

	public String getRule() {
		return rule;
	}

	public void setRule(String rule) {
		this.rule = rule;
	}

	public boolean isSaveHtml() {
		return saveHtml;
	}

	public void setSaveHtml(boolean saveHtml) {
		this.saveHtml = saveHtml;
	}

	public String getJobType() {
		return jobType;
	}

	public int getThreadNum() {
		return threadNum;
	}

	public void setThreadNum(int threadNum) {
		if (threadNum <= 0) {
			threadNum = 1;
		}
		this.threadNum = threadNum;
	}

	public boolean getParseUrl() {
		return parseUrl;
	}

	public void setParseUrl(Boolean parseUrl) {
		if (parseUrl == null) {
			parseUrl = true;
		}
		this.parseUrl = parseUrl;
	}

	public int getErrCount() {
		return errCount;
	}

	public void setErrCount(int errCount) {
		this.errCount = errCount;
	}

	@Override
	public Scheduler instanceScheduler() {
		return new HttpScheduler(this);
	}

}
